import { ReactNode } from 'react';

// 通用的列配置接口 - 支持任意字段名
export interface CustomColumnOptions {
  [fieldName: string]: {
    render?: (text: ReactNode, record: any) => ReactNode;
    width?: number;
    title?: string;
    ellipsis?: boolean;
    fixed?: 'left' | 'right';
    align?: 'left' | 'center' | 'right';
    [key: string]: any;
  };
}

// 表格配置选项接口
export interface TableOptions {
  custom?: CustomColumnOptions;
  methods?: any;
}

// 表格记录接口
export interface TableRecord {
  id: string | number;
  [key: string]: any;
}

// 表格操作接口
export interface TableMethods {
  openModal?: (type: string, record: TableRecord) => void;
  closeModal?: () => void;
  handleEdit?: (record: TableRecord) => void;
  handleDelete?: (record: TableRecord) => void;
  [key: string]: any;
}

// 字段配置接口
export interface FieldConfig {
  key: string;
  title: string;
  dataIndex?: string;
  width?: number;
  render?: (text: ReactNode, record: any) => ReactNode;
  [key: string]: any;
}
